package com.ssyan.boot.controller;

import com.ssyan.boot.bean.Car;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

//@ResponseBody//该类全局：浏览器返回字符串，非跳转页面
//@Controller
@Slf4j //开启日志自定义
@RestController //Controller+ResponseBody
public class HelloController {

    //@ResponseBody//向浏览器返回字符串，非跳转页面
    @RequestMapping("/hello")
    public String handle01() {
        log.info("请求进来了...");
        return "Hello,Spring Boot 2!"+"你好！";
    }

    @Autowired
    private Car car;

    @RequestMapping("/car")
    public Car car() {
        return car;
    }
}
